<?php
	include("initialize.php");
	include("write_functions.php");
	connect("localhost", "root", "", "gradegriddatabase");
?>
<!--
Displays all the students currently enrolled in a given course.
Used by addCourse.php as an iframe inset to tell the teacher
which students have been signed-up already.

@author Chad Estioco
@version Second Semester, AY 2010-2011
-->
<html>
	<head>
		<title>GradeGrid - Add Course</title>
		<style type="text/css">
			p, .pMirror{
				font-family: "Trebuchet MS", sans-serif;
				font-size: 13px;
				text-align: justify;
				color: #000000;
				margin-right: 8px;
			}
		
			h1{
				font-family: Arial, Helvetica, sans-serif;
				font-size: 18px;
				color: #000000;
			}
			
			.form_section{
				background-color: #DADADA;
				-moz-border-radius: 5px;
				-webkit-border-radius: 5px;
				border-radius: 5px;
				padding: 0px 4px;
				width: 100%;
				min-width: 30%;
			}
		</style>
		<script type="text/javascript" language="javascript">
			//TODO: Is this really needed?
			function createCourse(){
				alert("Course created.")
				document.getElementById("courseform").submit()
			}
		</script>
	</head>
	<body>
		<?php
			$classid = $_GET["classid"];
			$students_query = mysql_query("SELECT last_name, first_name FROM account, take WHERE
			                              account.account_id = take.account_id AND take.class_id = '$classid'
										  ORDER BY last_name, first_name");
			$students_limit = mysql_num_rows($students_query);
			$i = 0;
			
			while($i < $students_limit){
				mysql_data_seek($students_query, $i);
				$students_array = mysql_fetch_array($students_query);
				echo"<span class='pMirror'>" . $students_array["last_name"] . ", " . $students_array["first_name"] . "</span><br />";
				$i++;
			}
		?>
	</body>
</html>